<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>licensewizard.cpp 示例文件 | Qt Widgets 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-dialogs-licensewizard-example.html">License Wizard Example</a></td><td >licensewizard.cpp 示例文件</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtwidgets-index.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">licensewizard.cpp 示例文件</h1>
<span class="subtitle">dialogs/licensewizard/licensewizard.cpp</span>
<!-- $$$dialogs/licensewizard/licensewizard.cpp-description -->
<div class="descr"> <a name="details"></a>
<pre class="cpp">

  <span class="comment">/****************************************************************************
  **
  ** Copyright (C) 2016 The Qt Company Ltd.
  ** Contact: https://www.qt.io/licensing/
  **
  ** This file is part of the examples of the Qt Toolkit.
  **
  ** $QT_BEGIN_LICENSE:BSD$
  ** Commercial License Usage
  ** Licensees holding valid commercial Qt licenses may use this file in
  ** accordance with the commercial license agreement provided with the
  ** Software or, alternatively, in accordance with the terms contained in
  ** a written agreement between you and The Qt Company. For licensing terms
  ** and conditions see https://www.qt.io/terms-conditions. For further
  ** information use the contact form at https://www.qt.io/contact-us.
  **
  ** BSD License Usage
  ** Alternatively, you may use this file under the terms of the BSD license
  ** as follows:
  **
  ** &quot;Redistribution and use in source and binary forms, with or without
  ** modification, are permitted provided that the following conditions are
  ** met:
  **   * Redistributions of source code must retain the above copyright
  **     notice, this list of conditions and the following disclaimer.
  **   * Redistributions in binary form must reproduce the above copyright
  **     notice, this list of conditions and the following disclaimer in
  **     the documentation and/or other materials provided with the
  **     distribution.
  **   * Neither the name of The Qt Company Ltd nor the names of its
  **     contributors may be used to endorse or promote products derived
  **     from this software without specific prior written permission.
  **
  **
  ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  ** &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&quot;
  **
  ** $QT_END_LICENSE$
  **
  ****************************************************************************/</span>

  <span class="preprocessor">#include &lt;QtWidgets&gt;</span>
  <span class="preprocessor">#if defined(QT_PRINTSUPPORT_LIB)</span>
  <span class="preprocessor">#include &lt;QtPrintSupport/qtprintsupportglobal.h&gt;</span>
  <span class="preprocessor">#if QT_CONFIG(printdialog)</span>
  <span class="preprocessor">#include &lt;QPrinter&gt;</span>
  <span class="preprocessor">#include &lt;QPrintDialog&gt;</span>
  <span class="preprocessor">#endif</span>
  <span class="preprocessor">#endif</span>

  <span class="preprocessor">#include &quot;licensewizard.h&quot;</span>

  <span class="type"><a href="../qtcore/qstring.html">QString</a></span> emailRegExp <span class="operator">=</span> <span class="type"><a href="../qtcore/qstring.html#QStringLiteral">QStringLiteral</a></span>(<span class="string">&quot;.+@.+&quot;</span>);

  LicenseWizard<span class="operator">::</span>LicenseWizard(<span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>parent)
      : <span class="type"><a href="qwizard.html">QWizard</a></span>(parent)
  {
      setPage(Page_Intro<span class="operator">,</span> <span class="keyword">new</span> IntroPage);
      setPage(Page_Evaluate<span class="operator">,</span> <span class="keyword">new</span> EvaluatePage);
      setPage(Page_Register<span class="operator">,</span> <span class="keyword">new</span> RegisterPage);
      setPage(Page_Details<span class="operator">,</span> <span class="keyword">new</span> DetailsPage);
      setPage(Page_Conclusion<span class="operator">,</span> <span class="keyword">new</span> ConclusionPage);

      setStartId(Page_Intro);

  <span class="preprocessor">#ifndef Q_OS_MAC</span>
      setWizardStyle(ModernStyle);
  <span class="preprocessor">#endif</span>
      setOption(HaveHelpButton<span class="operator">,</span> <span class="keyword">true</span>);
      setPixmap(<span class="type"><a href="qwizard.html">QWizard</a></span><span class="operator">::</span>LogoPixmap<span class="operator">,</span> <span class="type"><a href="../qtgui/qpixmap.html">QPixmap</a></span>(<span class="string">&quot;:/images/logo.png&quot;</span>));

      connect(<span class="keyword">this</span><span class="operator">,</span> <span class="operator">&amp;</span><span class="type"><a href="qwizard.html">QWizard</a></span><span class="operator">::</span>helpRequested<span class="operator">,</span> <span class="keyword">this</span><span class="operator">,</span> <span class="operator">&amp;</span>LicenseWizard<span class="operator">::</span>showHelp);

      setWindowTitle(tr(<span class="string">&quot;License Wizard&quot;</span>));
  }

  <span class="type">void</span> LicenseWizard<span class="operator">::</span>showHelp()
  {
      <span class="keyword">static</span> <span class="type"><a href="../qtcore/qstring.html">QString</a></span> lastHelpMessage;

      <span class="type"><a href="../qtcore/qstring.html">QString</a></span> message;

      <span class="keyword">switch</span> (currentId()) {
      <span class="keyword">case</span> Page_Intro:
          message <span class="operator">=</span> tr(<span class="string">&quot;The decision you make here will affect which page you &quot;</span>
                       <span class="string">&quot;get to see next.&quot;</span>);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> Page_Evaluate:
          message <span class="operator">=</span> tr(<span class="string">&quot;Make sure to provide a valid email address, such as &quot;</span>
                       <span class="string">&quot;toni.buddenbrook@example.de.&quot;</span>);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> Page_Register:
          message <span class="operator">=</span> tr(<span class="string">&quot;If you don't provide an upgrade key, you will be &quot;</span>
                       <span class="string">&quot;asked to fill in your details.&quot;</span>);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> Page_Details:
          message <span class="operator">=</span> tr(<span class="string">&quot;Make sure to provide a valid email address, such as &quot;</span>
                       <span class="string">&quot;thomas.gradgrind@example.co.uk.&quot;</span>);
          <span class="keyword">break</span>;
      <span class="keyword">case</span> Page_Conclusion:
          message <span class="operator">=</span> tr(<span class="string">&quot;You must accept the terms and conditions of the &quot;</span>
                       <span class="string">&quot;license to proceed.&quot;</span>);
          <span class="keyword">break</span>;
      <span class="keyword">default</span>:
          message <span class="operator">=</span> tr(<span class="string">&quot;This help is likely not to be of any help.&quot;</span>);
      }

      <span class="keyword">if</span> (lastHelpMessage <span class="operator">=</span><span class="operator">=</span> message)
          message <span class="operator">=</span> tr(<span class="string">&quot;Sorry, I already gave what help I could. &quot;</span>
                       <span class="string">&quot;Maybe you should try asking a human?&quot;</span>);

      <span class="type"><a href="qmessagebox.html">QMessageBox</a></span><span class="operator">::</span>information(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">&quot;License Wizard Help&quot;</span>)<span class="operator">,</span> message);

      lastHelpMessage <span class="operator">=</span> message;
  }

  IntroPage<span class="operator">::</span>IntroPage(<span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>parent)
      : <span class="type"><a href="qwizardpage.html">QWizardPage</a></span>(parent)
  {
      setTitle(tr(<span class="string">&quot;Introduction&quot;</span>));
      setPixmap(<span class="type"><a href="qwizard.html">QWizard</a></span><span class="operator">::</span>WatermarkPixmap<span class="operator">,</span> <span class="type"><a href="../qtgui/qpixmap.html">QPixmap</a></span>(<span class="string">&quot;:/images/watermark.png&quot;</span>));

      topLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">&quot;This wizard will help you register your copy of &quot;</span>
                               <span class="string">&quot;&lt;i&gt;Super Product One&lt;/i&gt;&amp;trade; or start &quot;</span>
                               <span class="string">&quot;evaluating the product.&quot;</span>));
      topLabel<span class="operator">-</span><span class="operator">&gt;</span>setWordWrap(<span class="keyword">true</span>);

      registerRadioButton <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qradiobutton.html">QRadioButton</a></span>(tr(<span class="string">&quot;&amp;Register your copy&quot;</span>));
      evaluateRadioButton <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qradiobutton.html">QRadioButton</a></span>(tr(<span class="string">&quot;&amp;Evaluate the product for 30 &quot;</span>
                                                <span class="string">&quot;days&quot;</span>));
      registerRadioButton<span class="operator">-</span><span class="operator">&gt;</span>setChecked(<span class="keyword">true</span>);

      <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span> <span class="operator">*</span>layout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span>;
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(topLabel);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(registerRadioButton);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(evaluateRadioButton);
      setLayout(layout);
  }

  <span class="type">int</span> IntroPage<span class="operator">::</span>nextId() <span class="keyword">const</span>
  {
      <span class="keyword">if</span> (evaluateRadioButton<span class="operator">-</span><span class="operator">&gt;</span>isChecked()) {
          <span class="keyword">return</span> LicenseWizard<span class="operator">::</span>Page_Evaluate;
      } <span class="keyword">else</span> {
          <span class="keyword">return</span> LicenseWizard<span class="operator">::</span>Page_Register;
      }
  }

  EvaluatePage<span class="operator">::</span>EvaluatePage(<span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>parent)
      : <span class="type"><a href="qwizardpage.html">QWizardPage</a></span>(parent)
  {
      setTitle(tr(<span class="string">&quot;Evaluate &lt;i&gt;Super Product One&lt;/i&gt;&amp;trade;&quot;</span>));
      setSubTitle(tr(<span class="string">&quot;Please fill both fields. Make sure to provide a valid &quot;</span>
                     <span class="string">&quot;email address (e.g., john.smith@example.com).&quot;</span>));

      nameLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">&quot;N&amp;ame:&quot;</span>));
      nameLineEdit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>;
      nameLabel<span class="operator">-</span><span class="operator">&gt;</span>setBuddy(nameLineEdit);

      emailLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">&quot;&amp;Email address:&quot;</span>));
      emailLineEdit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>;
      emailLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setValidator(<span class="keyword">new</span> <span class="type"><a href="../qtgui/qregularexpressionvalidator.html">QRegularExpressionValidator</a></span>(<span class="type"><a href="../qtcore/qregularexpression.html">QRegularExpression</a></span>(emailRegExp)<span class="operator">,</span> <span class="keyword">this</span>));
      emailLabel<span class="operator">-</span><span class="operator">&gt;</span>setBuddy(emailLineEdit);

      registerField(<span class="string">&quot;evaluate.name*&quot;</span><span class="operator">,</span> nameLineEdit);
      registerField(<span class="string">&quot;evaluate.email*&quot;</span><span class="operator">,</span> emailLineEdit);

      <span class="type"><a href="qgridlayout.html">QGridLayout</a></span> <span class="operator">*</span>layout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgridlayout.html">QGridLayout</a></span>;
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(nameLabel<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(nameLineEdit<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(emailLabel<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(emailLineEdit<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">1</span>);
      setLayout(layout);
  }

  <span class="type">int</span> EvaluatePage<span class="operator">::</span>nextId() <span class="keyword">const</span>
  {
      <span class="keyword">return</span> LicenseWizard<span class="operator">::</span>Page_Conclusion;
  }

  RegisterPage<span class="operator">::</span>RegisterPage(<span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>parent)
      : <span class="type"><a href="qwizardpage.html">QWizardPage</a></span>(parent)
  {
      setTitle(tr(<span class="string">&quot;Register Your Copy of &lt;i&gt;Super Product One&lt;/i&gt;&amp;trade;&quot;</span>));
      setSubTitle(tr(<span class="string">&quot;If you have an upgrade key, please fill in &quot;</span>
                     <span class="string">&quot;the appropriate field.&quot;</span>));

      nameLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">&quot;N&amp;ame:&quot;</span>));
      nameLineEdit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>;
      nameLabel<span class="operator">-</span><span class="operator">&gt;</span>setBuddy(nameLineEdit);

      upgradeKeyLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">&quot;&amp;Upgrade key:&quot;</span>));
      upgradeKeyLineEdit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>;
      upgradeKeyLabel<span class="operator">-</span><span class="operator">&gt;</span>setBuddy(upgradeKeyLineEdit);

      registerField(<span class="string">&quot;register.name*&quot;</span><span class="operator">,</span> nameLineEdit);
      registerField(<span class="string">&quot;register.upgradeKey&quot;</span><span class="operator">,</span> upgradeKeyLineEdit);

      <span class="type"><a href="qgridlayout.html">QGridLayout</a></span> <span class="operator">*</span>layout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgridlayout.html">QGridLayout</a></span>;
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(nameLabel<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(nameLineEdit<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(upgradeKeyLabel<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(upgradeKeyLineEdit<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">1</span>);
      setLayout(layout);
  }

  <span class="type">int</span> RegisterPage<span class="operator">::</span>nextId() <span class="keyword">const</span>
  {
      <span class="keyword">if</span> (upgradeKeyLineEdit<span class="operator">-</span><span class="operator">&gt;</span>text()<span class="operator">.</span>isEmpty()) {
          <span class="keyword">return</span> LicenseWizard<span class="operator">::</span>Page_Details;
      } <span class="keyword">else</span> {
          <span class="keyword">return</span> LicenseWizard<span class="operator">::</span>Page_Conclusion;
      }
  }

  DetailsPage<span class="operator">::</span>DetailsPage(<span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>parent)
      : <span class="type"><a href="qwizardpage.html">QWizardPage</a></span>(parent)
  {
      setTitle(tr(<span class="string">&quot;Fill In Your Details&quot;</span>));
      setSubTitle(tr(<span class="string">&quot;Please fill all three fields. Make sure to provide a valid &quot;</span>
                     <span class="string">&quot;email address (e.g., tanaka.aya@example.co.jp).&quot;</span>));

      companyLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">&quot;&amp;Company name:&quot;</span>));
      companyLineEdit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>;
      companyLabel<span class="operator">-</span><span class="operator">&gt;</span>setBuddy(companyLineEdit);

      emailLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">&quot;&amp;Email address:&quot;</span>));
      emailLineEdit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>;
      emailLineEdit<span class="operator">-</span><span class="operator">&gt;</span>setValidator(<span class="keyword">new</span> <span class="type"><a href="../qtgui/qregularexpressionvalidator.html">QRegularExpressionValidator</a></span>(<span class="type"><a href="../qtcore/qregularexpression.html">QRegularExpression</a></span>(emailRegExp)<span class="operator">,</span> <span class="keyword">this</span>));
      emailLabel<span class="operator">-</span><span class="operator">&gt;</span>setBuddy(emailLineEdit);

      postalLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">&quot;&amp;Postal address:&quot;</span>));
      postalLineEdit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>;
      postalLabel<span class="operator">-</span><span class="operator">&gt;</span>setBuddy(postalLineEdit);

      registerField(<span class="string">&quot;details.company*&quot;</span><span class="operator">,</span> companyLineEdit);
      registerField(<span class="string">&quot;details.email*&quot;</span><span class="operator">,</span> emailLineEdit);
      registerField(<span class="string">&quot;details.postal*&quot;</span><span class="operator">,</span> postalLineEdit);

      <span class="type"><a href="qgridlayout.html">QGridLayout</a></span> <span class="operator">*</span>layout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgridlayout.html">QGridLayout</a></span>;
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(companyLabel<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(companyLineEdit<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(emailLabel<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(emailLineEdit<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">1</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(postalLabel<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">0</span>);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(postalLineEdit<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">1</span>);
      setLayout(layout);
  }

  <span class="type">int</span> DetailsPage<span class="operator">::</span>nextId() <span class="keyword">const</span>
  {
      <span class="keyword">return</span> LicenseWizard<span class="operator">::</span>Page_Conclusion;
  }

  ConclusionPage<span class="operator">::</span>ConclusionPage(<span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>parent)
      : <span class="type"><a href="qwizardpage.html">QWizardPage</a></span>(parent)
  {
      setTitle(tr(<span class="string">&quot;Complete Your Registration&quot;</span>));
      setPixmap(<span class="type"><a href="qwizard.html">QWizard</a></span><span class="operator">::</span>WatermarkPixmap<span class="operator">,</span> <span class="type"><a href="../qtgui/qpixmap.html">QPixmap</a></span>(<span class="string">&quot;:/images/watermark.png&quot;</span>));

      bottomLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>;
      bottomLabel<span class="operator">-</span><span class="operator">&gt;</span>setWordWrap(<span class="keyword">true</span>);

      agreeCheckBox <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcheckbox.html">QCheckBox</a></span>(tr(<span class="string">&quot;I agree to the terms of the license&quot;</span>));

      registerField(<span class="string">&quot;conclusion.agree*&quot;</span><span class="operator">,</span> agreeCheckBox);

      <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span> <span class="operator">*</span>layout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span>;
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(bottomLabel);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(agreeCheckBox);
      setLayout(layout);
  }

  <span class="type">int</span> ConclusionPage<span class="operator">::</span>nextId() <span class="keyword">const</span>
  {
      <span class="keyword">return</span> <span class="operator">-</span><span class="number">1</span>;
  }

  <span class="type">void</span> ConclusionPage<span class="operator">::</span>initializePage()
  {
      <span class="type"><a href="../qtcore/qstring.html">QString</a></span> licenseText;

      <span class="keyword">if</span> (wizard()<span class="operator">-</span><span class="operator">&gt;</span>hasVisitedPage(LicenseWizard<span class="operator">::</span>Page_Evaluate)) {
          licenseText <span class="operator">=</span> tr(<span class="string">&quot;&lt;u&gt;Evaluation License Agreement:&lt;/u&gt; &quot;</span>
                           <span class="string">&quot;You can use this software for 30 days and make one &quot;</span>
                           <span class="string">&quot;backup, but you are not allowed to distribute it.&quot;</span>);
      } <span class="keyword">else</span> <span class="keyword">if</span> (wizard()<span class="operator">-</span><span class="operator">&gt;</span>hasVisitedPage(LicenseWizard<span class="operator">::</span>Page_Details)) {
          licenseText <span class="operator">=</span> tr(<span class="string">&quot;&lt;u&gt;First-Time License Agreement:&lt;/u&gt; &quot;</span>
                           <span class="string">&quot;You can use this software subject to the license &quot;</span>
                           <span class="string">&quot;you will receive by email.&quot;</span>);
      } <span class="keyword">else</span> {
          licenseText <span class="operator">=</span> tr(<span class="string">&quot;&lt;u&gt;Upgrade License Agreement:&lt;/u&gt; &quot;</span>
                           <span class="string">&quot;This software is licensed under the terms of your &quot;</span>
                           <span class="string">&quot;current license.&quot;</span>);
      }
      bottomLabel<span class="operator">-</span><span class="operator">&gt;</span>setText(licenseText);
  }

  <span class="type">void</span> ConclusionPage<span class="operator">::</span>setVisible(bool visible)
  {
      <span class="type"><a href="qwizardpage.html">QWizardPage</a></span><span class="operator">::</span>setVisible(visible);

      <span class="keyword">if</span> (visible) {
          wizard()<span class="operator">-</span><span class="operator">&gt;</span>setButtonText(<span class="type"><a href="qwizard.html">QWizard</a></span><span class="operator">::</span>CustomButton1<span class="operator">,</span> tr(<span class="string">&quot;&amp;Print&quot;</span>));
          wizard()<span class="operator">-</span><span class="operator">&gt;</span>setOption(<span class="type"><a href="qwizard.html">QWizard</a></span><span class="operator">::</span>HaveCustomButton1<span class="operator">,</span> <span class="keyword">true</span>);
          connect(wizard()<span class="operator">,</span> <span class="operator">&amp;</span><span class="type"><a href="qwizard.html">QWizard</a></span><span class="operator">::</span>customButtonClicked<span class="operator">,</span>
                  <span class="keyword">this</span><span class="operator">,</span> <span class="operator">&amp;</span>ConclusionPage<span class="operator">::</span>printButtonClicked);
      } <span class="keyword">else</span> {
          wizard()<span class="operator">-</span><span class="operator">&gt;</span>setOption(<span class="type"><a href="qwizard.html">QWizard</a></span><span class="operator">::</span>HaveCustomButton1<span class="operator">,</span> <span class="keyword">false</span>);
          disconnect(wizard()<span class="operator">,</span> <span class="operator">&amp;</span><span class="type"><a href="qwizard.html">QWizard</a></span><span class="operator">::</span>customButtonClicked<span class="operator">,</span>
                     <span class="keyword">this</span><span class="operator">,</span> <span class="operator">&amp;</span>ConclusionPage<span class="operator">::</span>printButtonClicked);
      }
  }

  <span class="type">void</span> ConclusionPage<span class="operator">::</span>printButtonClicked()
  {
  <span class="preprocessor">#if QT_CONFIG(printdialog)</span>
      <span class="type">QPrinter</span> printer;
      <span class="type">QPrintDialog</span> dialog(<span class="operator">&amp;</span>printer<span class="operator">,</span> <span class="keyword">this</span>);
      <span class="keyword">if</span> (dialog<span class="operator">.</span>exec())
          <span class="type"><a href="qmessagebox.html">QMessageBox</a></span><span class="operator">::</span>warning(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">&quot;Print License&quot;</span>)<span class="operator">,</span>
                               tr(<span class="string">&quot;As an environmentally friendly measure, the &quot;</span>
                                  <span class="string">&quot;license text will not actually be printed.&quot;</span>));
  <span class="preprocessor">#endif</span>
  }

</pre>
</div>
<!-- @@@dialogs/licensewizard/licensewizard.cpp -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
